import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        while (sc.hasNext()){
            int num=sc.nextInt();
            int[] arr=new int[num];
            for (int i = 0; i < num; i++) {
                arr[i]= sc.nextInt();
            }
            int[] tmp=new int[num];
            int max=1;tmp[0]=1;
            for (int i = 1; i < num; i++) {
                tmp[i]=1;
                for (int j = 0; j < i; j++) {
                    if (arr[i]>arr[j]&&tmp[i]<=tmp[j]){
                        tmp[i]=tmp[j]+1;
                        if (max<tmp[i]){
                            max=tmp[i];
                        }
                    }
                }
            }
            System.out.println(max);
        }
    }
}



